<template>
  <div>
    <el-dialog title="用户详情" v-model="dialogVisible" width="50%" close-on-press-escape top="0" :close-on-click-modal="false" :before-close="handleClose">
      <el-form :model="form" :rules="rules" ref="ruleForm" size="small">
        <el-form-item label="员工姓名" label-width="100px" prop="name" label-position="right">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="员工手机号" label-width="100px" prop="phone" label-position="right">
          <el-input v-model="form.phone"></el-input>
        </el-form-item>
        <el-form-item label="员工岗位" label-width="100px" prop="station" label-position="right">
          <el-select v-model="form.station">
            <el-option value="1" label="产品经理">产品经理</el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { reactive, toRefs, watchEffect } from 'vue'
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    }
  },
  setup(props) {
    const state = reactive({
      form: {
        name: '',
        phone: '',
        station: ''
      },
      rules: {
        name: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        phone: [{ required: true, message: '请选择活动区域', trigger: 'change' }]
      }
    })
    watchEffect(() => {
      console.log(props)
    })
    return {
      ...toRefs(state)
    }
  }
}
</script>

<style lang="less" scoped></style>
